package com.ly.heart.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ly.common.annotation.Excel;
import com.ly.common.core.domain.BaseVo;

import java.util.Date;
import java.util.List;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * <p>
 * 采购订单管理
 * </p>
 * @author WuZH
 * @since 2024-05-14
 */
@Getter
@Setter
@Data
@Accessors(chain = true)
@TableName ("erp_order_info")
@ApiModel (value = "采购订单管理", description = "采购订单管理")
public class OrderEntity extends BaseVo {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty ("id")
    @TableId (value = "id", type = IdType.INPUT)
    private String id;

    @ApiModelProperty ("层级（0采购订单 1采购订单新变更单）不用传")
    @TableField ("level")
    private Integer level;

    @ApiModelProperty ("项目id")
    @TableField ("project_id")
    private String projectId;

    @ApiModelProperty ("父id(采购订单变更时使用)")
    @TableField ("parent_id")
    private String parentId;

    @ApiModelProperty ("项目名称")
    @TableField(exist = false)
    private String projectName;

    @ApiModelProperty ("厂家出库时间")
    @JsonFormat ( pattern = "yyyy-MM-dd" )
    @TableField ("factory_time")
    private Date factoryTime;

    @ApiModelProperty ("源单类型(0采购合同 1采购申请单 2销售订单 3询价单 4采购订单(代表变更) )")
    @TableField ("source_doc_type")
    private String sourceDocType;

    @ApiModelProperty ("源订单编号(变更单用,直接新增无需)")
    @TableField ("original_order_code")
    private String originalOrderCode;

    @ApiModelProperty ("单据类型（单据类型接口：1标准采购订单;2直运采购订单;3资产采购订单;4分销购销采购订单）")
    @TableField ("doc_type")
    private String docType;

    @ApiModelProperty ("业务类型（与单据类型相对应）")
    @TableField ("doc_business_type")
    private String docBusinessType;

    @ApiModelProperty ("订单金额，销售订单的金额来自于销售合同；有可能一份采购合同对应多份采购订单，故订单金额录入")
    @TableField ("money")
    private String money;

    @ApiModelProperty ("创建人Id，销售订单取自销售合同")
    @TableField ("create_id")
    private String createId;

    @ApiModelProperty ("订单编号")
    @TableField ("order_number")
    private String orderNumber;

    @ApiModelProperty ("订单状态；1：已下单；2：已入库/已出库")
    @TableField ("STATUS")
    private Integer status;

    @ApiModelProperty ("录入人")
    @TableField ("user_id")
    private String userId;

    @ApiModelProperty ("创建时间")
    @JsonFormat ( pattern = "yyyy-MM-dd HH:mm:ss" )
    @TableField ("create_time")
    private Date createTime;

    @ApiModelProperty ("更新时间")
    @JsonFormat( pattern = "yyyy-MM-dd HH:mm:ss" )
    @TableField ("change_time")
    private Date changeTime;

    @TableField ("is_used")
    @TableLogic
    private Integer isUsed;

    @ApiModelProperty ("流程实例id")
    @TableField ("instance_id")
    private String instanceId;

    @ApiModelProperty ("流程状态")
    @TableField ("state")
    private String state;

    @ApiModelProperty ("单据编号")
    @TableField ("document_code")
    @Excel(name = "单据编号")
    private String documentCode;

    @ApiModelProperty ("采购日期")
    @JsonFormat( pattern = "yyyy-MM-dd" )
    @TableField ("apply_time")
    private Date applyTime;

    @ApiModelProperty ("供应商id")
    @TableField ("supplier_id")
    private String supplierId;

    @ApiModelProperty ("供应商编码")
    @TableField ("supplier_code")
    private String supplierCode;

    @ApiModelProperty ("供应商名称")
    @TableField(exist = false)
    private String supplierName;

    @ApiModelProperty ("采购组织(子公司列表，走接口)")
    @TableField ("purchase_org")
    @Excel (name = "采购组织(子公司列表，走接口)")
    private String purchaseOrg;

    @ApiModelProperty ("采购组织code")
    @TableField ("purchase_org_code")
    @Excel (name = "采购组织code")
    private String purchaseOrgCode;

    @ApiModelProperty ("采购部门(部门列表，走接口)")
    @TableField ("purchase_dept")
    @Excel (name = "采购部门(部门列表，走接口)")
    private String purchaseDept;

    @ApiModelProperty ("采购部门code")
    @TableField ("purchase_dept_code")
    @Excel (name = "采购部门code")
    private String purchaseDeptCode;

    @ApiModelProperty ("采购组(采购组，走接口)")
    @TableField ("purchase_group")
    @Excel (name = "采购组(采购组，走接口)")
    private String purchaseGroup;

    @ApiModelProperty ("采购组code")
    @TableField ("purchase_group_code")
    @Excel (name = "采购组code")
    private String purchaseGroupCode;

    @ApiModelProperty ("验收方式")
    @TableField ("check_method")
    private String checkMethod;

    @ApiModelProperty ("采购员id")
    @TableField ("apply_id")
    private String applyId;

    @ApiModelProperty ("是否暂存")
    @TableField ("is_temp")
    private Boolean isTemp;

    /** 结算币别(币别表id，走接口) */
    @ApiModelProperty ("结算币别(币别表code，走接口)")
    @TableField ("settlement_currency")
    private String settlementCurrency;

    /** 付款条件(付款条件表id，走接口) */
    @ApiModelProperty ("付款条件(付款条件表code，走接口)")
    @TableField ("term_of_payment")
    private String termOfPayment;

    /** 结算方式(结算方式表id，走接口) */
    @ApiModelProperty ("结算方式(结算方式表code，走接口)")
    @TableField ("settlement_method")
    private String settlementMethod;

    /** 汇率类型(汇率类型表id，走接口) */
    @ApiModelProperty ("汇率类型(汇率类型表code，走接口)")
    @TableField ("exchange_rate_type")
    private String exchangeRateType;

    /** 汇率 */
    @ApiModelProperty ("汇率")
    @TableField ("exchange_rate")
    @Excel (name = "汇率")
    private String exchangeRate;

    /** 价目表(价目表id，走接口) */
    @ApiModelProperty ("价目表(价目表code，走接口)")
    @TableField ("price_info_id")
    private String priceInfoId;

    /** 折扣表(折扣表id，走接口) */
    @ApiModelProperty ("折扣表(折扣表code，走接口)")
    @TableField ("discount_info_id")
    private String discountInfoId;

    /** 定价时点（select走字典） */
    @TableField ("pricing_time_point")
    @ApiModelProperty ("定价时点")
    @Excel (name = "定价时点", readConverterExp = "select走字典")
    private String pricingTimePoint;

    /** 集中结算组织(子公司列表) */
    @ApiModelProperty ("集中结算组织(子公司列表)")
    @TableField ("focus_settlement_dept")
    @Excel (name = "集中结算组织(子公司列表)")
    private String focusSettlementDept;

    /** 是否含税 */
    @ApiModelProperty ("是否含税")
    @TableField ("is_tax")
    @Excel (name = "是否含税")
    private Boolean isTax;

    /** 是否含价外税 */
    @ApiModelProperty ("是否含价外税")
    @TableField ("is_extra_price_tax")
    @Excel (name = "是否含价外税")
    private Boolean isExtraPriceTax;

    /** 保证金比例 */
    @ApiModelProperty ("保证金比例")
    @TableField ("ensure_rate")
    @Excel (name = "保证金比例")
    private String ensureRate;

    /** 保证金 */
    @ApiModelProperty ("保证金")
    @TableField ("ensure")
    @Excel (name = "保证金")
    private String ensure;

    /** 整单折扣金额 */
    @ApiModelProperty ("整单折扣金额")
    @TableField ("whole_discount_amount")
    @Excel (name = "整单折扣金额")
    private String wholeDiscountAmount;

    /** 税额 */
    @ApiModelProperty ("税额")
    @TableField ("tax_amount")
    @Excel (name = "税额")
    private String taxAmount;

    /** 金额 */
    @ApiModelProperty ("金额")
    @TableField ("money_amount")
    @Excel (name = "金额")
    private String moneyAmount;

    /** 价税合计 */
    @ApiModelProperty ("价税合计")
    @TableField ("total_price_tax")
    @Excel (name = "价税合计")
    private String totalPriceTax;

    /** 本位币 */
    @ApiModelProperty ("本位币")
    @TableField ("base_currency")
    @Excel (name = "本位币")
    private String baseCurrency;

    /** 税额(本位币) */
    @ApiModelProperty ("税额(本位币)")
    @TableField ("tax_amount_base")
    @Excel (name = "税额(本位币)")
    private String taxAmountBase;

    /** 金额(本位币) */
    @ApiModelProperty ("金额(本位币)")
    @TableField ("money_amount_base")
    @Excel (name = "金额(本位币)")
    private String moneyAmountBase;

    /** 价税合计(本位币) */
    @ApiModelProperty ("价税合计(本位币)")
    @TableField ("total_price_tax_base")
    @Excel (name = "价税合计(本位币)")
    private String totalPriceTaxBase;

    /** 累计付款申请金额 */
    @ApiModelProperty ("累计付款申请金额")
    @TableField ("total_payment_apply_amount")
    @Excel (name = "累计付款申请金额")
    private String totalPaymentApplyAmount;

    /** 申请单未付款金额 */
    @ApiModelProperty ("申请单未付款金额")
    @TableField ("apply_form_unpaid_amount")
    @Excel (name = "申请单未付款金额")
    private String applyFormUnpaidAmount;

    /** 累计付款金额 */
    @ApiModelProperty ("累计付款金额")
    @TableField ("total_payment_amount")
    @Excel (name = "累计付款金额")
    private String totalPaymentAmount;

    /** 订单未付款金额 */
    @ApiModelProperty ("订单未付款金额")
    @TableField ("total_unpaid_amount")
    @Excel (name = "订单未付款金额")
    private String totalUnpaidAmount;

    /** 累计退款金额 */
    @ApiModelProperty ("累计退款金额")
    @TableField ("total_return_amount")
    @Excel (name = "累计退款金额")
    private String totalReturnAmount;

    /** 创建人 */
    @ApiModelProperty ("创建人")
    @TableField ("create_name")
    @Excel (name = "创建人")
    private String createName;

    /** 最后修改人 */
    @ApiModelProperty ("最后修改人")
    @TableField ("last_update_name")
    @Excel (name = "最后修改人")
    private String lastUpdateName;

    /** 最后修改日期 */
    @ApiModelProperty ("最后修改日期")
    @TableField ("last_update_time")
    @JsonFormat( pattern = "yyyy-MM-dd HH:mm:ss" )
    @Excel (name = "最后修改日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date lastUpdateTime;

    /** 审核人 */
    @ApiModelProperty ("审核人")
    @TableField ("examine_name")
    @Excel (name = "审核人")
    private String examineName;

    /** 审核日期 */
    @ApiModelProperty ("审核日期")
    @TableField ("examine_time")
    @JsonFormat( pattern = "yyyy-MM-dd HH:mm:ss" )
    @Excel (name = "审核日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date examineTime;

    /** 关闭状态 */
    @ApiModelProperty ("关闭状态")
    @TableField ("close_state")
    @Excel (name = "关闭状态")
    private String closeState;

    /** 关闭人 */
    @ApiModelProperty ("关闭人")
    @TableField ("close_name")
    @Excel (name = "关闭人")
    private String closeName;

    /** 关闭日期 */
    @ApiModelProperty ("关闭日期")
    @TableField ("close_time")
    @JsonFormat( pattern = "yyyy-MM-dd HH:mm:ss" )
    @Excel (name = "关闭日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date closeTime;

    /** 作废状态 */
    @ApiModelProperty ("作废状态")
    @TableField ("invalid_state")
    @Excel (name = "作废状态")
    private String invalidState;

    /** 作废人 */
    @ApiModelProperty ("作废人")
    @TableField ("invalid_name")
    @Excel (name = "作废人")
    private String invalidName;

    /** 作废日期 */
    @ApiModelProperty ("作废日期")
    @TableField ("invalid_time")
    @JsonFormat( pattern = "yyyy-MM-dd HH:mm:ss" )
    @Excel (name = "作废日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date invalidTime;

    /** 确认状态 */
    @ApiModelProperty ("确认状态")
    @TableField ("confirm_state")
    @Excel (name = "确认状态")
    private String confirmState;

    /** 是否手工关闭 */
    @ApiModelProperty ("是否手工关闭")
    @TableField ("is_manual_close")
    @Excel (name = "是否手工关闭")
    private Boolean isManualClose;

    /** 版本号 */
    @ApiModelProperty ("版本号")
    @TableField ("version")
    @Excel (name = "版本号")
    private String version;

    /** 变更人 */
    @ApiModelProperty ("变更人")
    @TableField ("update_name")
    @Excel (name = "变更人")
    private String updateName;

    /** 修改人 */
    @ApiModelProperty ("修改人")
    @TableField ("update_by")
    @Excel (name = "修改人")
    private String updateBy;

    /** 变更日期 */
    @ApiModelProperty ("变更日期")
    @TableField ("update_time")
    @JsonFormat( pattern = "yyyy-MM-dd HH:mm:ss" )
    @Excel (name = "变更日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date updateTime;

    /** 确认人 */
    @ApiModelProperty ("确认人")
    @TableField ("confirm_name")
    @Excel (name = "确认人")
    private String confirmName;

    /** 确认日期 */
    @ApiModelProperty ("确认日期")
    @TableField ("confirm_time")
    @JsonFormat( pattern = "yyyy-MM-dd HH:mm:ss" )
    @Excel (name = "确认日期")
    private Date confirmTime;

    /** 关闭原因 */
    @ApiModelProperty ("关闭原因")
    @TableField ("close_reason")
    @Excel (name = "关闭原因")
    private String closeReason;

    /** 变更状态 */
    @ApiModelProperty ("变更状态(0未变更 1已变更)")
    @TableField ("update_state")
    @Excel (name = "变更状态")
    private String updateState;

    /** 变更原因 */
    @ApiModelProperty ("变更原因（只用作变更单，必填项）")
    @TableField ("change_reason")
    @Excel (name = "变更原因")
    private String changeReason;

    @ApiModelProperty ( "是否发送金蝶；1：是；2：否" )
    @TableField ( "is_send" )
    @Excel ( name = "是否发送金蝶" )
    private Integer isSend;

    @ApiModelProperty("业务type")
    @TableField (exist = false)
    private String businessType;

    @ApiModelProperty("流程模型id")
    @TableField (exist = false)
    private String modelId;

    @ApiModelProperty("采购明细")
    @TableField(exist = false)
    private List<MaterialDetailEntity> orderDetails;

    @ApiModelProperty("供应商信息")
    @TableField(exist = false)
    private OrderSupplierEntity orderSupplier;

//    @ApiModelProperty("交货安排信息")
//    @TableField(exist = false)
//    private List<OrderDeliveryEntity> orderDeliverys;

    @ApiModelProperty("付款执行明细")
    @TableField(exist = false)
    private List<OrderPaymentExecutionEntity> orderPaymentExecutions;

    @ApiModelProperty("采购订单条款")
    @TableField(exist = false)
    private List<OrderPurchaseTermsEntity> orderPurchaseTerms;

//    @ApiModelProperty("明细财务信息")
//    @TableField(exist = false)
//    private List<OrderFinanceDetailEntity> orderFinanceDetails;

    @ApiModelProperty("付款计划")
    @TableField(exist = false)
    private List<OrderPaymentPlanEntity> orderPaymentPlans;

//    @ApiModelProperty("其他信息")
//    @TableField(exist = false)
//    private List<OrderOtherEntity> orderOthers;



    @ApiModelProperty("采购组织名称")
    @TableField(exist = false)
    private String purchaseOrgName;

    @ApiModelProperty("采购员名称")
    @TableField(exist = false)
    private String applyName;

    @ApiModelProperty("采购部门名称")
    @TableField(exist = false)
    private String purchaseDeptName;

    @ApiModelProperty("采购组名称")
    @TableField(exist = false)
    private String purchaseGroupName;

    @ApiModelProperty("结算币别名称")
    @TableField(exist = false)
    private String settlementCurrencyName;

    @ApiModelProperty("结算方式名称")
    @TableField(exist = false)
    private String settlementMethodName;

    @ApiModelProperty("付款条件名称")
    @TableField(exist = false)
    private String termOfPaymentName;

    @ApiModelProperty("汇率类型名称")
    @TableField(exist = false)
    private String exchangeRateTypeName;

    @ApiModelProperty("价目表名称")
    @TableField(exist = false)
    private String priceInfoName;

    @ApiModelProperty("折扣表名称")
    @TableField(exist = false)
    private String discountInfoName;

    @ApiModelProperty("集中结算组织名称")
    @TableField(exist = false)
    private String focusSettlementDeptName;


}
